package com.example.demo.pattern.mixpattern.factory;

import com.example.demo.pattern.mixpattern.entity.counter.QuackCounter;
import com.example.demo.pattern.mixpattern.entity.duck.QuackAble;
import com.example.demo.pattern.mixpattern.entity.duck.impl.DuckCall;
import com.example.demo.pattern.mixpattern.entity.duck.impl.MallardDuck;
import com.example.demo.pattern.mixpattern.entity.duck.impl.RedHeadDuck;
import com.example.demo.pattern.mixpattern.entity.duck.impl.RubberDuck;

//生产带计数功能的鸭子，过一下装饰者QuackCounter
public class CountingDuckFactory extends AbstractDuckFactory{
    @Override
    public QuackAble createMallardDuck() {
        return new QuackCounter(new MallardDuck());
    }

    @Override
    public QuackAble createRedHeadDuck() {
        return new QuackCounter(new RedHeadDuck());
    }

    @Override
    public QuackAble createRubberDuck() {
        return new QuackCounter(new RubberDuck());
    }

    @Override
    public QuackAble createDuckCall() {
        return new QuackCounter(new DuckCall());
    }
}
